package com.wakala.employment.fragment.recruit;

import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.github.gzuliyujiang.wheelpicker.OptionPicker;
import com.github.gzuliyujiang.wheelpicker.contract.OnNumberSelectedListener;
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionPickedListener;
import com.github.gzuliyujiang.wheelpicker.contract.OnOptionSelectedListener;
import com.github.gzuliyujiang.wheelpicker.widget.NumberWheelLayout;
import com.github.gzuliyujiang.wheelpicker.widget.OptionWheelLayout;
import com.hjq.toast.Toaster;
import com.kongzue.dialogx.dialogs.BottomDialog;
import com.kongzue.dialogx.dialogs.BottomMenu;
import com.kongzue.dialogx.dialogs.FullScreenDialog;
import com.kongzue.dialogx.dialogs.InputDialog;
import com.kongzue.dialogx.dialogs.MessageMenu;
import com.kongzue.dialogx.dialogs.PopTip;
import com.kongzue.dialogx.interfaces.OnBindView;
import com.kongzue.dialogx.interfaces.OnInputDialogButtonClickListener;
import com.kongzue.dialogx.interfaces.OnMenuButtonClickListener;
import com.kongzue.dialogx.interfaces.OnMenuItemClickListener;
import com.kongzue.dialogx.interfaces.OnMenuItemSelectListener;
import com.kongzue.dialogx.style.KongzueStyle;
import com.kongzue.dialogx.style.MIUIStyle;
import com.leaf.library.StatusBarUtil;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.interfaces.OnCancelListener;
import com.lxj.xpopup.interfaces.OnConfirmListener;
import com.wakala.employment.R;
import com.wakala.employment.adapter.base.FlowTagAdapter;
import com.wakala.employment.adapter.bean.OptionBean;
import com.wakala.employment.adapter.bean.PoiEntity;
import com.wakala.employment.adapter.bean.UserAddress;
import com.wakala.employment.adapter.entity.JobInfoVo;
import com.wakala.employment.adapter.jobCategory.JobCategoryTreeVo;
import com.wakala.employment.core.BaseFragment;
import com.wakala.employment.core.bean.EventKey;
import com.wakala.employment.core.constants.Constants;
import com.wakala.employment.core.http.subscriber.NoTipRequestSubscriber;
import com.wakala.employment.databinding.FragmentRecruitIssueBinding;
import com.wakala.employment.fragment.finder.JobCategoryFragment;
import com.wakala.employment.fragment.other.AddressSelectFragment;
import com.wakala.employment.http.TestApi;
import com.wakala.employment.http.bean.JobInfoRequest;
import com.wakala.employment.utils.ForEachUtils;
import com.xuexiang.rxutil2.rxbus.RxBusUtils;
import com.xuexiang.rxutil2.rxbus.RxEvent;
import com.xuexiang.xhttp2.XHttpProxy;
import com.xuexiang.xhttp2.exception.ApiException;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xpage.utils.GsonUtils;
import com.xuexiang.xui.utils.ResUtils;
import com.xuexiang.xui.utils.XToastUtils;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.flowlayout.FlowTagLayout;
import com.xuexiang.xui.widget.tabbar.TabControlView;
import com.xuexiang.xutil.common.RegexUtils;
import com.xuexiang.xutil.common.StringUtils;
import com.xuexiang.xutil.display.DensityUtils;
import com.xuexiang.xutil.net.JsonUtil;
import com.xuexiang.xutil.tip.ToastUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.functions.Consumer;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link RecruitIssueFragment#} factory method to
 * create an instance of this fragment.
 */
@Page(anim = CoreAnim.none)
public class RecruitIssueFragment extends BaseFragment<FragmentRecruitIssueBinding> implements View.OnClickListener {

    private static final String TAG="RecruitIssueFragment";
    /**
     * 招聘职位信息发布请求数据对象
     */
    private JobInfoRequest mJobInfoRequest;
    private String[] jobTypeOptions;
    //---------------定位-----
    //声明AMapLocationClient类对象
    //public AMapLocationClient mLocationClient = null;
    //声明定位回调监听器
    //public AMapLocationListener mLocationListener = new MyAMapLocationListener();
    //声明AMapLocationClientOption对象
    //public AMapLocationClientOption mLocationOption = null;

    //private String editCity="";

    //------------------------

    private TextView btnClose;
    private WebView webView;

   // private CustomDialog customDialog = null;//搜索加载等待对话框

    private TextView btnReplyCommit;
    private TextView btnCancelCommit;
    private EditText editReplyCommit;

    //用户选择的工种
    private ArrayList<String> tagLayoutTags = new ArrayList<>();
    private ArrayList<JobCategoryTreeVo> selectedJobList = new ArrayList<>();
    //
    com.xuexiang.xui.widget.flowlayout.FlowLayout jobTagLayout,welfareTagLayout;

    //---
    private String[] singleSelectMenuText = new String[]{"拒绝", "询问", "始终允许", "仅在使用中允许"};
    private int selectMenuIndex;

    private int selectedJobTypeIndex=0;

    /**
     * ----------------------------------------------------------------------------
     * 结算方式选择
     */
    private String[] multiSelectMenuText = new String[]{ "月结", "日结", "周结","完工结","计件"};
    private int[] selectMenuIndexArray;
    private String multiSelectMenuResultCache;
    //-------------------------------------------------------

    /**
     * ------薪水选择
     */
    private TextView btnCancel, btnSubmit, tvSalaryModeName;
    private FlowTagLayout mSingleFlowTagLayout;
    private LinearLayout llSalaryRange;

    private NumberWheelLayout numSalaryStart, numSalaryEnd;

    /**
     * 薪水模式代码
     */
    private String modeCode = "";
    /**
     * 薪水模式名称
     */
    private String modeName = "";

    /**
     * 薪资范围 起
     */
    private Integer rangeStart = 0;
    /**
     * 薪资范围 至
     */
    private Integer rangeEnd = 0;

    private Map<String, String> modeValueMap = new HashMap<>();
    private Map<Integer, String> modeIndexMap = new HashMap<>();
    private Map<String, Integer> modeResultMap = new HashMap<>();

    private Boolean hasSelectSalaryRang = false;
    //-----------------------------

    private  boolean isEdit = false;
    private JobInfoVo  jobInfoVoEdit=null;
    ///


    /**
     * @return 返回为 null意为不需要导航栏
     */
    @Override
    protected TitleBar initTitle() {
        TitleBar titleBar = super.initTitle();
        titleBar.setTitle("发布招工");
        if(isEdit){
            titleBar.setTitle("修改信息");
        }
        titleBar.setTitleColor(R.color.black);
        titleBar.setLeftTextColor(R.color.black);
        titleBar.setLeftImageDrawable(getResources().getDrawable(R.drawable.icon_arrow_back));
        titleBar.setBackgroundResource(R.color.white);//设置标题栏背景颜色
        titleBar.setActionTextColor(R.color.black);
        titleBar.setLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if(isEdit){
                    new XPopup.Builder(getContext()).asConfirm("温馨提示", "确定要放弃修改返回吗？", "返回", "继续修改", new OnConfirmListener() {
                        @Override
                        public void onConfirm() {

                        }
                    }, new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            popToBack();
                        }
                    },false,R.layout.dialog_confim_popup).show();
                }else {
                    new XPopup.Builder(getContext()).asConfirm("温馨提示", "确定要退出吗？发布后最快1小时内就能招到靠谱的优秀工人啦！", "暂不发布", "继续发布", new OnConfirmListener() {
                        @Override
                        public void onConfirm() {

                        }
                    }, new OnCancelListener() {
                        @Override
                        public void onCancel() {
                            popToBack();
                        }
                    },false,R.layout.dialog_confim_popup).show();
                }

            }
        });
        StatusBarUtil.setDarkMode(getActivity());
        titleBar.addAction(new TitleBar.TextAction("招聘管理") {
            @Override
            public int getDrawable() {
                return R.drawable.icon_service;
            }

            @Override
            public void performAction(View view) {
                openNewPage(RecruitManageFragment.class);
            }
        });
        //设置状态栏背景颜色，如果设置为 Color.TRANSPARENT 将会隐藏状态栏
        getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.white));
        return titleBar;
    }

    @NonNull
    @Override
    protected FragmentRecruitIssueBinding viewBindingInflate(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, boolean attachToRoot) {
        return FragmentRecruitIssueBinding.inflate(inflater, container, attachToRoot);
    }

    @Override
    public void onFragmentResult(int requestCode, int resultCode, Intent data) {
        //super.onFragmentResult(requestCode, resultCode, data);
        if(resultCode==Constants.REQ_RESULT_111){
            //工种分类选择返回数据
            selectedJobList = data.getParcelableArrayListExtra("selectedJobList");
            tagLayoutTags=data.getStringArrayListExtra("tagLayoutTags");
            String kindText = "";
            for(String tagText:tagLayoutTags){
                kindText+=tagText+"、";
            }
            kindText = StringUtils.cutString(kindText,0,kindText.length()-1);
            binding.tvKindText.setText(kindText);
            binding.ssBtnIssueWorkKinds.setText("");
            StringBuilder jobCategoryIds = new StringBuilder();
            for(JobCategoryTreeVo jobCategoryTreeVo:selectedJobList){
                jobCategoryIds.append(jobCategoryTreeVo.getId());
            }
            if(jobCategoryIds.length()>0){
                mJobInfoRequest.setJobCategoryId(jobCategoryIds.toString());
            }


        }else if(resultCode==Constants.REQ_RESULT_113){//职位标签
            ArrayList<String> selectedTagList = data.getStringArrayListExtra("selectedTagList");
            if(!selectedTagList.isEmpty()){
                jobTagLayout.removeAllViews();
                binding.tvJobTagTip.setVisibility(View.GONE);
                mJobInfoRequest.setJobTags(StringUtils.concatSpiltWith(",",selectedJobList));
                mJobInfoRequest.setJobTags(mJobInfoRequest.getJobTags().replace("[","").replace("]",""));
            }else{
                binding.tvJobTagTip.setVisibility(View.VISIBLE);
            }
            for(String tagName:selectedTagList){
                addTag(jobTagLayout,tagName,"blue");
            }
            if(jobTagLayout.getChildCount()>0){
                binding.tvJobTagTip.setVisibility(View.GONE);
            }
        }else if(resultCode==Constants.REQ_RESULT_114){//福利标签
            ArrayList<String> selectedTagList = data.getStringArrayListExtra("selectedTagList");
            if(!selectedTagList.isEmpty()){
                welfareTagLayout.removeAllViews();
                binding.tvWelfareTagTip.setVisibility(View.GONE);
                mJobInfoRequest.setWelfareTags(StringUtils.concatSpiltWith(",",selectedJobList));
                mJobInfoRequest.setWelfareTags(mJobInfoRequest.getWelfareTags().replace("[","").replace("]",""));
            }else{
                binding.tvJobTagTip.setVisibility(View.VISIBLE);
            }
            for(String tagName:selectedTagList){
                addTag(welfareTagLayout,tagName,"blue");
            }
            if(welfareTagLayout.getChildCount()>0){
                binding.tvWelfareTagTip.setVisibility(View.GONE);
            }
        }
    }

    @Override
    protected void initArgs() {
        mJobInfoRequest = new JobInfoRequest();
        //职位/招工类型
        mJobInfoRequest.setJobType(1);//全职
        Object object = getArguments().get("edit-data");
        if(object instanceof JobInfoVo){
            //修改模式
            isEdit= true;
            jobInfoVoEdit = (JobInfoVo)object;
            //初始化
            String jobInfoJson = GsonUtils.toJson(jobInfoVoEdit);
            mJobInfoRequest = GsonUtils.fromJson(jobInfoJson,JobInfoRequest.class);
        }
    }

    // 重写onActivityResult方法接收回传数据
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 101 && data!=null) {
            String poiEntityStr = data.getStringExtra("poiEntity");
            // 处理回传的数据
            if(!StringUtils.isEmpty(poiEntityStr)){
                PoiEntity poiEntity = JsonUtil.fromJson(poiEntityStr,PoiEntity.class);
                String fullAddress = poiEntity.getAddress();
                binding.tvMyAddress.setText(fullAddress);
                //
                UserAddress userAddress = new UserAddress();
                userAddress.setCity(poiEntity.getCityName());
                userAddress.setCityId(Integer.valueOf(poiEntity.getCityCode()));
                userAddress.setProvince(poiEntity.getProvinceName());
                userAddress.setDistrict(poiEntity.getAdName());
                userAddress.setLatitude(poiEntity.getLat());
                userAddress.setLongitude(poiEntity.getLon());
                userAddress.setDetail(poiEntity.getSnippet());
                userAddress.setPoiName(poiEntity.getTitle());
                //设置地址信息
                mJobInfoRequest.setJobUserAddress(userAddress);
            }
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        RxBusUtils.get().unregisterAll(EventKey.EVENT_ADDRESS_SELECTED);
    }

    @Override
    protected void initViews() {
        //初始化招工类型数据
        jobTypeOptions = getResources().getStringArray(R.array.job_type_option);
        //
        binding.rtvIssueTip.setOnClickListener(this);
        binding.ssBtnIssueChooseLocal.setOnClickListener(this);
        //
        //------------------------
        binding.fjEdit.setEtMinHeight(500);
        //
        jobTagLayout = binding.tagLayoutJogTags;
        jobTagLayout.removeAllViews();
        //
        welfareTagLayout = binding.tagLayoutWelfareTags;
        welfareTagLayout.removeAllViews();
        //
        initSalaryData();
        if (isEdit) {
            initEditData();
        }
    }

    /**
     * 初始化数据绑定页面组件
     */
    private void initEditData(){
        //保存按钮名称
        binding.sbSubmit.setText("确认修改");
        //地址
        binding.tvMyAddress.setText(jobInfoVoEdit.getJobUserAddress().getDetail());
        //工种名称
        binding.tvKindText.setText(jobInfoVoEdit.getJobCategoryName());
        //招工标题
        binding.tvTitleText.setText(jobInfoVoEdit.getTitle());
        //招工详情
        if(!StringUtils.isEmpty(jobInfoVoEdit.getContent())){
            binding.fjEdit.setText(Html.fromHtml(jobInfoVoEdit.getContent(),Html.FROM_HTML_MODE_COMPACT).toString());
        }
        //招工电话
        if(!StringUtils.isEmpty(jobInfoVoEdit.getLinkPhone())){
            binding.stModifyJobPhone.setCenterString(jobInfoVoEdit.getLinkPhone());
        }

        //招工联系人
        binding.stModifyJobLinkMan.setCenterString(mJobInfoRequest.getLinkMan());
        //工资
        binding.stModifySalary.setCenterString(jobInfoVoEdit.getSalaryName());
        //结算方式
        if(!StringUtils.isEmpty(jobInfoVoEdit.getSettlementModeName())){
            binding.stModifySettlement.setCenterString(jobInfoVoEdit.getSettlementModeName());
        }
        //招工人数
        if(!StringUtils.isEmpty(jobInfoVoEdit.getPersonNumName())){
            binding.stModifyPersonNum.setCenterString(jobInfoVoEdit.getPersonNumName());
        }

        //性别
        binding.stModifySex.setCenterString(jobInfoVoEdit.getSexName());
        //年龄
        binding.stModifyAge.setCenterString(jobInfoVoEdit.getAgeName());
        //学历
        binding.stModifyEdu.setCenterString(jobInfoVoEdit.getEduName());
        //婚否  --废弃
        //职位标签
        for(String tagName:jobInfoVoEdit.getJobTagsList()){
            addTag(jobTagLayout,tagName,"blue");
        }
        if(jobTagLayout.getChildCount()>0){
            binding.tvJobTagTip.setVisibility(View.GONE);
        }
        //福利标签
        for(String tagName:jobInfoVoEdit.getWelfareTagsList()){
            addTag(welfareTagLayout,tagName,"blue");
        }
        if(welfareTagLayout.getChildCount()>0){
            binding.tvWelfareTagTip.setVisibility(View.GONE);
        }

    }

    /**
     * 初始化薪水数据
     */
    private void initSalaryData(){
        //--------薪水选择初始化----------
        modeValueMap.put("R", "日");
        modeValueMap.put("Y", "月");
        modeValueMap.put("J", "件");
        modeValueMap.put("M", "面议");
        //
        modeIndexMap.put(0, "R");
        modeIndexMap.put(1, "Y");
        modeIndexMap.put(2, "J");
        modeIndexMap.put(3, "M");
        //
        modeResultMap.put("M", 0);
        modeResultMap.put("R", 1);
        modeResultMap.put("Y", 2);
        modeResultMap.put("J", 3);
        //-----------------
    }

    @Override
    protected void initListeners() {
        //-------------------------
        binding.tvModifyJobType.setOnTabSelectionChangedListener(new TabControlView.OnTabSelectionChangedListener(){

            @Override
            public void newSelection(String title, String value) {
                Log.i("newSelection", "title:" + title + " value:" + value);
                //获取value值在jobTypeOptions数组中的索引
                int index = Arrays.asList(jobTypeOptions).indexOf(value);
                mJobInfoRequest.setJobType(index);
            }
        });
        binding.ssBtnIssueWorkKinds.setOnClickListener(this);
        binding.stModifySex.setOnClickListener(this);//性别
        binding.stModifyAge.setOnClickListener(this);//年龄
        binding.stModifyEdu.setOnClickListener(this);//文化程度
        binding.stModifyMarriage.setOnClickListener(this);//婚姻状况
        binding.ssBtnIssueModifyTitle.setOnClickListener(this);//招工标题
        binding.stModifyJobPhone.setOnClickListener(this);
        binding.sbSubmit.setOnClickListener(this);//发布
        binding.btnModifyJobTags.setOnClickListener(this);//修改职位标签
        binding.btnModifyWelfareTags.setOnClickListener(this);//修改福利标签
        binding.stModifySettlement.setOnClickListener(this);//修改结算方式
        binding.stModifySalary.setOnClickListener(this);//修改工资
        binding.stModifyPersonNum.setOnClickListener(this);//修改招聘人数
        binding.stModifyJobLinkMan.setOnClickListener(this);//修改联系人
        //initLocation();
        RxBusUtils.get().on(EventKey.EVENT_ADDRESS_SELECTED, RxEvent.class, new Consumer<RxEvent>() {
            @Override
            public void accept(RxEvent event) throws Exception {
                //RxToast.success("事件key:"+EventKey.EVENT_HAVE_DATA);
                UserAddress mUserAddress = (UserAddress) event.getData();
                String fullAddress = mUserAddress.getProvince()+mUserAddress.getCity()+mUserAddress.getDistrict()+mUserAddress.getDetail();
                binding.tvMyAddress.setText(fullAddress);
                //
                //设置地址信息
                mJobInfoRequest.setJobUserAddress(mUserAddress);
                //Toaster.show("事件key:"+EventKey.EVENT_ADDRESS_SELECTED);
            }
        });
    }


    @Override
    public void onClick(View view) {
        int id = view.getId();
        if(id==R.id.ssBtn_issue_work_kinds){
            openPageForResult(JobCategoryFragment.class,Constants.REQ_RESULT_111);
        }
        if(id == R.id.ssBtn_issue_choose_local){
            openNewPage(AddressSelectFragment.class);
            //Intent intent = new Intent(getContext(), AddressMapActivity.class);
            //startActivityForResult(intent,101);
        } else if (id ==R.id.ssBtn_issue_modify_title) {
            modifyTitle();
        } else if (id ==R.id.st_modify_settlement) {//结算方式
            modifySettlement();
        } else if (id == R.id.st_modify_salary) {//工资
            showSalarySelect();
        } else if (id == R.id.st_modify_person_num) {//招聘人数
            modifyPersonNum();
        } else if (id == R.id.btn_modify_job_tags) {//职位标签
            openPageForResult(TagEditFragment.class, Constants.REQ_RESULT_113);
        } else if (id == R.id.btn_modify_welfare_tags) {//福利标签
            openPageForResult(TagEditFragment.class, Constants.REQ_RESULT_114);
        }else if(id == R.id.rtv_issue_tip){
            showTip();
        }else if (id == R.id.st_modify_sex) {
            modifySex();
        } else if (id == R.id.st_modify_age) {
            modifyAge();
        } else if (id == R.id.st_modify_edu) {
            modifyEdu();
        } else if (id == R.id.st_modify_marriage) {
            modifyMarriage();
        } else if (id == R.id.st_modify_job_link_man) {
            modifyLinkMan();
        } else if (id == R.id.st_modify_job_phone) {
            showBindPhoneNumber();
        } else if (id==R.id.sb_submit) {
            submitRecruit();
        }
    }

    @SuppressLint("UseCompatLoadingForDrawables")
    private void addTag(com.xuexiang.xui.widget.flowlayout.FlowLayout linearLayout, String tagName, String themName){
        TextView textView = new TextView(getContext());
        ViewGroup.MarginLayoutParams textViewParams = new ViewGroup.MarginLayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, // 宽度
                ViewGroup.LayoutParams.WRAP_CONTENT  // 高度
        );
        textViewParams.setMargins(DensityUtils.dip2px(getContext(), 5), 0, 0, DensityUtils.dip2px(getContext(), 5));
        textView.setPadding(DensityUtils.dip2px(getContext(), 2),DensityUtils.dip2px(getContext(), 2),DensityUtils.dip2px(getContext(), 2),DensityUtils.dip2px(getContext(), 2));
        textView.setLayoutParams(textViewParams);
        textView.setText(tagName);
        textView.setTextSize(12.0f);

        if("blue".equals(themName)){
            textView.setBackgroundColor(getResources().getColor(R.color.tag_bg_blue));
            textView.setBackground(getResources().getDrawable(R.drawable.rounded_corner_tag_blue));
            textView.setTextColor(getResources().getColor(R.color.colorPrimary));
        } else if ("gray".equals(themName)) {
            textView.setBackgroundColor(getResources().getColor(R.color.tag_bg_gray));
            textView.setTextColor(getResources().getColor(R.color.tag_text_gray));
        }else {
            textView.setBackgroundColor(getResources().getColor(R.color.tag_bg_blue));
            textView.setTextColor(getResources().getColor(R.color.colorPrimary));
        }
        linearLayout.addView(textView);
    }

    private void singleSelect(){
        MessageMenu.show(singleSelectMenuText).setStyle(MIUIStyle.style())
                .setShowSelectedBackgroundTips(true)
                .setMessage("这里是权限确认的文本说明，这是一个演示菜单")
                .setTitle("获得权限标题")
                .setOnMenuItemClickListener(new OnMenuItemSelectListener<MessageMenu>() {
                    @Override
                    public void onOneItemSelect(MessageMenu dialog, CharSequence text, int index, boolean select) {
                        selectMenuIndex = index;
                    }
                })
                .setCancelButton("确定", new OnMenuButtonClickListener<MessageMenu>() {
                    @Override
                    public boolean onClick(MessageMenu baseDialog, View v) {
                        PopTip.show("已选择：" + singleSelectMenuText[selectMenuIndex]);
                        return false;
                    }
                })
                .setSelection(selectMenuIndex);

    }

    /**
     * 修改招聘人数
     */

    private void modifyPersonNum() {
        List<OptionBean> data = new ArrayList<>();
        data.add(new OptionBean("0", "不定"));
        data.add(new OptionBean("1", "1-2人"));
        data.add(new OptionBean("2", "3-5人"));
        data.add(new OptionBean("3", "6-10人"));
        data.add(new OptionBean("4", "11-20人"));
        data.add(new OptionBean("5", "20人以上"));

        OptionPicker picker = new OptionPicker(getActivity());
        picker.setTitle("人数");
        picker.setBodyWidth(140);
        picker.setData(data);
        picker.setDefaultPosition(1);
        picker.setOnOptionPickedListener(new OnOptionPickedListener() {
            @Override
            public void onOptionPicked(int position, Object item) {
                //toast(item.toString());
                binding.stModifyPersonNum.setCenterString(item.toString());
                //更新工作年限
                OptionBean optionBean = (OptionBean) item;
               //设置招聘人数数据
            }
        });
        OptionWheelLayout wheelLayout = picker.getWheelLayout();
        //wheelLayout.setIndicatorEnabled(false);
//        wheelLayout.setTextColor(0xFFFF00FF);
//        wheelLayout.setSelectedTextColor(0xFFFF0000);
//        wheelLayout.setTextSize(15 * getResources().getDisplayMetrics().scaledDensity);
        wheelLayout.setSelectedTextBold(true);
//        wheelLayout.setCurtainEnabled(true);
//        wheelLayout.setCurtainColor(0xEEFF0000);
//        wheelLayout.setCurtainCorner(CurtainCorner.ALL);
//        wheelLayout.setCurtainRadius(5 * getResources().getDisplayMetrics().density);
        wheelLayout.setOnOptionSelectedListener(new OnOptionSelectedListener() {
            @Override
            public void onOptionSelected(int position, Object item) {
                picker.getTitleView().setText(picker.getWheelView().formatItem(position));
            }
        });
        picker.show();
    }


    private void modifySettlement(){
        MessageMenu.build().setStyle(KongzueStyle.style()).show(multiSelectMenuText)
                .setMessage("选择合适的结算方式")
                .setTitle("请选择结算方式")
                .setOnMenuItemClickListener(new OnMenuItemSelectListener<MessageMenu>() {
                    @Override
                    public void onMultiItemSelect(MessageMenu dialog, CharSequence[] text, int[] index) {
                        multiSelectMenuResultCache = "";
                        for (CharSequence c : text) {
                            multiSelectMenuResultCache = multiSelectMenuResultCache + " " + c;
                        }
                        selectMenuIndexArray = index;
                    }
                })
                .setOkButton("确定", new OnMenuButtonClickListener<MessageMenu>() {
                    @Override
                    public boolean onClick(MessageMenu dialog, View v) {
                        PopTip.show("已选择：" + multiSelectMenuResultCache);
                        binding.stModifySettlement.setCenterString(multiSelectMenuResultCache);
                        return false;
                    }
                })
//                        .setCancelButton("确定", new OnDialogButtonClickListener<MessageDialog>() {
//                            @Override
//                            public boolean onClick(MessageDialog baseDialog, View v) {
//                                PopTip.show("已选择：" + multiSelectMenuResultCache);
//                                return false;
//                            }
//                        })
                .setSelection(selectMenuIndexArray)
        ;
    }

    private void modifyTitle(){
        BottomDialog.show(new OnBindView<BottomDialog>( R.layout.layout_custom_reply) {
                    @Override
                    public void onBind(final BottomDialog dialog, View v) {
                        btnReplyCommit = v.findViewById(R.id.btn_reply_commit);
                        btnCancelCommit = v.findViewById(R.id.btn_cancel_commit);
                        editReplyCommit = v.findViewById(R.id.edit_reply_commit);
                        if(isEdit && !StringUtils.isEmpty(jobInfoVoEdit.getTitle())){
                            editReplyCommit.setText(jobInfoVoEdit.getTitle());
                        }
                        btnCancelCommit.setOnClickListener(view -> dialog.dismiss());
                        btnReplyCommit.setOnClickListener(v1 -> {
                            dialog.dismiss();
                            //PopTip.show("提交内容：\n" + editReplyCommit.getText().toString());
                            binding.tvTitleText.setText(editReplyCommit.getText().toString());
                            if(editReplyCommit.getText().toString()!=""){
                                mJobInfoRequest.setTitle(editReplyCommit.getText().toString());
                            }
                        });
                        editReplyCommit.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                showIME(editReplyCommit);
                            }
                        }, 300);
                    }
                })
                .setAllowInterceptTouch(false);
    }
    public void showIME(EditText editText) {
        if (editText == null) {
            return;
        }
        editText.requestFocus();
        editText.setFocusableInTouchMode(true);
        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(editText, InputMethodManager.RESULT_UNCHANGED_SHOWN);
    }

    /**
     * 性别
     */
    private void modifySex(){
        BottomMenu.show(new String[]{"不限","男","女"})
                .setMessage("选择性别").setCancelable(false).setCancelButton("取消")
                .setOnMenuItemClickListener(new OnMenuItemClickListener<BottomMenu>() {
                    @Override
                    public boolean onClick(BottomMenu dialog, CharSequence text, int index) {
                        binding.stModifySex.setCenterString(text);
                        mJobInfoRequest.setSex(index);
                        return false;
                    }
                });
    }

    /**
     * 年龄
     */
    private void modifyAge(){
        List<OptionBean> data = new ArrayList<>();
        data.add(new OptionBean("0","不限"));
        data.add(new OptionBean("20","20岁以下"));
        data.add(new OptionBean("25","25岁以下"));
        data.add(new OptionBean("30","30岁以下"));
        data.add(new OptionBean("35","35岁以下"));
        data.add(new OptionBean("40","40岁以下"));
        data.add(new OptionBean("45","45岁以下"));
        data.add(new OptionBean("50","50岁以下"));
        data.add(new OptionBean("55","55岁以下"));

        OptionPicker picker = new OptionPicker(getActivity());
        picker.setTitle("年龄");
        picker.setBodyWidth(140);
        picker.setData(data);
        picker.setDefaultPosition(2);
        picker.setOnOptionPickedListener(new OnOptionPickedListener() {
            @Override
            public void onOptionPicked(int position, Object item) {
                //toast(item.toString());
                binding.stModifyAge.setCenterString(item.toString());
                //更新学历文化程度
                OptionBean optionBean = (OptionBean) item;
                mJobInfoRequest.setAge(Integer.parseInt(optionBean.getId()));
            }
        });
        picker.show();
    }

    /**
     * 新婚姻状态
     */
    private void modifyMarriage() {
        List<OptionBean> data = new ArrayList<>();
        data.add(new OptionBean("0","未婚"));
        data.add(new OptionBean("1","已婚"));
        data.add(new OptionBean("2","不限"));

        OptionPicker picker = new OptionPicker(getActivity());
        picker.setTitle("婚姻状况");
        picker.setBodyWidth(140);
        picker.setData(data);
        picker.setDefaultPosition(1);
        picker.setOnOptionPickedListener(new OnOptionPickedListener() {
            @Override
            public void onOptionPicked(int position, Object item) {
                //更新婚姻状态
                OptionBean optionBean = (OptionBean) item;
                binding.stModifyMarriage.setCenterString(item.toString());
            }
        });
        picker.show();
    }

    /**
     *  学历
     */
    private void modifyEdu(){
        List<OptionBean> data = new ArrayList<>();
        data.add(new OptionBean("0","不限"));
        data.add(new OptionBean("1","初、高中以上"));
        data.add(new OptionBean("2","中专、职业技校以上"));
        data.add(new OptionBean("3","大学专科以上"));
        data.add(new OptionBean("4","大学本科以上"));
        data.add(new OptionBean("5","硕士" +
                "以上"));


        OptionPicker picker = new OptionPicker(getActivity());
        picker.setTitle("文化程度");
        picker.setBodyWidth(140);
        picker.setData(data);
        picker.setDefaultPosition(2);
        picker.setOnOptionPickedListener(new OnOptionPickedListener() {
            @Override
            public void onOptionPicked(int position, Object item) {
                //toast(item.toString());
                binding.stModifyEdu.setCenterString(item.toString());
                //更新学历文化程度
                OptionBean optionBean = (OptionBean) item;
                mJobInfoRequest.setEdu(Integer.parseInt(optionBean.getId()));
            }
        });
        picker.show();
    }
    private void  showTip(){
        FullScreenDialog.show(new OnBindView<FullScreenDialog>(R.layout.layout_full_webview) {
            @Override
            public void onBind(final FullScreenDialog dialog, View v) {
                btnClose = v.findViewById(R.id.btn_close);
                webView = v.findViewById(R.id.webView);

                btnClose.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                });

                WebSettings webSettings = webView.getSettings();
                webSettings.setJavaScriptEnabled(true);
                webSettings.setLoadWithOverviewMode(true);
                webSettings.setUseWideViewPort(true);
                webSettings.setSupportZoom(false);
                webSettings.setAllowFileAccess(true);
                webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
                webSettings.setLoadsImagesAutomatically(true);
                webSettings.setDefaultTextEncodingName("utf-8");

                webView.setWebViewClient(new WebViewClient() {
                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        try {
                            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                            startActivity(intent);
                        } catch (ActivityNotFoundException e) {
                            e.printStackTrace();
                        }
                        return true;
                    }

                    @Override
                    public void onPageFinished(WebView view, String url) {
                        super.onPageFinished(view, url);
                    }
                });

                webView.loadUrl("https://www.miaoyankeji.com/protocol/job_pulish_protocol.html");
            }
        }).setBottomNonSafetyAreaBySelf(false);

    }

    /**
     * 修改联系人
     */
    private void modifyLinkMan() {
        String preInputText = binding.stModifyJobLinkMan.getCenterString();
        if(StringUtils.isEmpty(preInputText)){
            preInputText="";
        }
        if(preInputText.equals("填写联系人")){
            preInputText="";
        }
        //InputDialog inputDialog = InputDialog.build().setStyle(MIUIStyle.style()).setTitle("系统提示").setMessage("请输入招工联系电话");
        new InputDialog("招工联系人", "请输入联系人名称", "确定", "取消", preInputText)
                .setCancelable(false)
                .setOkButton(new OnInputDialogButtonClickListener<InputDialog>() {
                    @Override
                    public boolean onClick(InputDialog baseDialog, View v, String inputStr) {
                        if (com.wakala.employment.utils.RegexUtils.checkChinese(inputStr) && inputStr.length()>=2) {
                            binding.stModifyJobLinkMan.setCenterString(inputStr);
                            baseDialog.dismiss();
                            //更新简历联系电话
                            mJobInfoRequest.setLinkMan(inputStr);
                        } else {
                            Toaster.show("输入的联系人名称不正确");
                        }
                        return true;
                    }
                }).setStyle(MIUIStyle.style())
                .show();
    }


    private void showBindPhoneNumber() {
        String preInputText = binding.stModifyJobPhone.getCenterString();
        //InputDialog inputDialog = InputDialog.build().setStyle(MIUIStyle.style()).setTitle("系统提示").setMessage("请输入招工联系电话");
        new InputDialog("招工电话", "请输入正确的手机号码", "确定", "取消", preInputText)
                .setCancelable(false)
                .setOkButton(new OnInputDialogButtonClickListener<InputDialog>() {
                    @Override
                    public boolean onClick(InputDialog baseDialog, View v, String inputStr) {
                        if (RegexUtils.isMobileExact(inputStr)) {
                            binding.stModifyJobPhone.setCenterString(inputStr);
                            baseDialog.dismiss();
                            //更新简历联系电话
                            mJobInfoRequest.setLinkPhone(inputStr);
                        } else {
                            Toaster.show("输入的手机号码不正确");
                        }
                        return true;
                    }
                }).setStyle(MIUIStyle.style())
                .show();
    }

    /*private void initLocation() {
        //初始化定位
        try {
            AMapLocationClient.updatePrivacyShow(getContext(), true, true);
            AMapLocationClient.updatePrivacyAgree(getContext(), true);
            mLocationClient = new AMapLocationClient(getContext());
        } catch (Exception e) {
            e.printStackTrace();
        }
        //设置定位回调监听
        mLocationClient.setLocationListener(mLocationListener);
        //初始化AMapLocationClientOption对象
        mLocationOption = new AMapLocationClientOption();
        //设置定位模式为AMapLocationMode.Hight_Accuracy，高精度模式。
        mLocationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
        //获取一次定位结果：
        //该方法默认为false。
        mLocationOption.setOnceLocation(false);

        //获取最近3s内精度最高的一次定位结果：
        //设置setOnceLocationLatest(boolean b)接口为true，启动定位时SDK会返回最近3s内精度最高的一次定位结果。如果设置其为true，setOnceLocation(boolean b)接口也会被设置为true，反之不会，默认为false。
        mLocationOption.setOnceLocationLatest(true);
        //设置是否返回地址信息（默认返回地址信息）
        mLocationOption.setNeedAddress(true);
        //设置是否允许模拟位置,默认为false，不允许模拟位置
        mLocationOption.setMockEnable(false);
        //关闭缓存机制
        mLocationOption.setLocationCacheEnable(false);
        //给定位客户端对象设置定位参数
        mLocationClient.setLocationOption(mLocationOption);
        //启动定位
        XXPermissions.with(this)
                // 申请单个权限
                .permission(Permission.ACCESS_BACKGROUND_LOCATION)
                // 设置权限请求拦截器（局部设置）
                //.interceptor(new PermissionInterceptor())
                // 设置不触发错误检测机制（局部设置）
                //.unchecked()
                .request(new OnPermissionCallback() {

                    @Override
                    public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
                        if (!allGranted) {
                            toast("获取部分权限成功，但部分权限未正常授予");
                            return;
                        }
                        mLocationClient.startLocation();

                    }

                    @Override
                    public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
                        if (doNotAskAgain) {
                            toast("被永久拒绝授权，请手动授予定位权限");
                            // 如果是被永久拒绝就跳转到应用权限系统设置页面
                            XXPermissions.startPermissionActivity(getContext(), permissions);
                        } else {
                            toast("获取定位权限失败");
                        }
                    }
                });
    }*/


    /*private class MyAMapLocationListener implements AMapLocationListener {

        @Override
        public void onLocationChanged(AMapLocation aMapLocation) {
            if (aMapLocation != null) {
                if (aMapLocation.getErrorCode() == 0) {
                    Log.e(TAG+"-位置：", aMapLocation.getAddress());
                    String address = aMapLocation.getAddress();
                    String city = aMapLocation.getCity();
                    String cityCode = aMapLocation.getCityCode();
                    String locationDetail= aMapLocation.getLocationDetail();
                    //editCity.setText(aMapLocation.getCity());
                    editCity = aMapLocation.getCity();
                    binding.tvMyAddress.setText(address);
                    mLocationClient.stopLocation();


                } else {
                    Toaster.show("定位失败");
                    //定位失败时，可通过ErrCode（错误码）信息来确定失败的原因，errInfo是错误信息，详见错误码表。
                    String error="location Error, ErrCode:"
                            + aMapLocation.getErrorCode() + ", errInfo:"
                            + aMapLocation.getErrorInfo();
                    Log.e("AmapError", "location Error, ErrCode:"
                            + aMapLocation.getErrorCode() + ", errInfo:"
                            + aMapLocation.getErrorInfo());
                }
            }
        }
    }
*/
    //-------------------
    /**
     * -----薪水选择相关组件---------------------------------
     */
    private void initSingleFlowTagLayout() {
        FlowTagAdapter tagAdapter = new FlowTagAdapter(getContext());
        mSingleFlowTagLayout.setAdapter(tagAdapter);
        mSingleFlowTagLayout.setTagCheckedMode(FlowTagLayout.FLOW_TAG_CHECKED_SINGLE);
        mSingleFlowTagLayout.setOnTagSelectListener((parent, position, selectedList) -> DoOnTagSelect(parent, position, selectedList));
        tagAdapter.addTags(ResUtils.getStringArray(getContext(), R.array.salary_tags_values));
        tagAdapter.setSelectedPositions(0);

    }

    private String DoOnTagSelect(FlowTagLayout parent, int position, List<Integer> selectedList) {
        StringBuilder sb = new StringBuilder("选中的内容：\n");
        for (int index : selectedList) {
            sb.append(parent.getAdapter().getItem(index));
            sb.append(";");
        }
        if (3 == position) {
            llSalaryRange.setVisibility(View.GONE);
        } else {
            llSalaryRange.setVisibility(View.VISIBLE);
        }
        initNumSalaryPicker(position);
        getSalaryUnitStr(position);
        return sb.toString();
    }

    /**
     * 薪水范围选贼器 数据选中事件绑定
     */
    private void bindEventSalaryPicker() {
        numSalaryStart.setOnNumberSelectedListener(new OnNumberSelectedListener() {
            @Override
            public void onNumberSelected(int position, Number item) {
                rangeStart = item.intValue();
                //设置薪水返回已经选择过
                hasSelectSalaryRang = true;
            }
        });
        numSalaryEnd.setOnNumberSelectedListener(new OnNumberSelectedListener() {
            @Override
            public void onNumberSelected(int position, Number item) {
                rangeEnd = item.intValue();
            }
        });
    }

    private void initNumSalaryPicker(Integer jieSuanFS) {
        if (null == jieSuanFS) {
            jieSuanFS = 0;
        }
        if (jieSuanFS == 0) {
            //日结
            numSalaryStart.setRange(100, 2000, 100);
            numSalaryEnd.setRange(200, 2100, 100);
            //初始化选择器的选值
            rangeStart = 100;
            rangeEnd = 200;
        } else if (jieSuanFS == 1) {
            //月结
            numSalaryStart.setRange(1000, 290000, 1000);
            numSalaryEnd.setRange(2000, 300000, 1000);
            //初始化选择器的选值
            rangeStart = 1000;
            rangeEnd = 2000;
        } else if (jieSuanFS == 2) {
            //计量
            numSalaryStart.setRange(1, 490, 10);
            numSalaryEnd.setRange(10, 500, 10);
            //初始化选择器的选值
            rangeStart = 1;
            rangeEnd = 10;
        }
    }

    private String getSalaryUnitStr(Integer unitIndex) {
        String pre = "单位：元/";
        if (3 == unitIndex) {
            pre = "";
        }
        modeCode = modeIndexMap.get(unitIndex);
        modeName = modeValueMap.get(modeIndexMap.get(unitIndex));
        tvSalaryModeName.setText(pre + modeName);
        return pre + modeName;
    }

    private void showSalarySelect() {
        /**
         * 采用异步加载布局防止卡顿测试
         */

        OnBindView<FullScreenDialog> onBindView;
        onBindView = new OnBindView<FullScreenDialog>(R.layout.layout_dialog_salary_for_recruit_issue, false) {
            @Override
            public void onBind(FullScreenDialog dialog, View v) {
                btnCancel = v.findViewById(R.id.btn_cancel);
                btnSubmit = v.findViewById(R.id.btn_submit);
                tvSalaryModeName = v.findViewById(R.id.tv_salary_mode_name);
                mSingleFlowTagLayout = v.findViewById(R.id.flowlayout_single_select);
                llSalaryRange = v.findViewById(R.id.ll_salary_range);
                initSingleFlowTagLayout();
                numSalaryStart = v.findViewById(R.id.num_salary_start);
                numSalaryEnd = v.findViewById(R.id.num_salary_end);
                initNumSalaryPicker(0);
                bindEventSalaryPicker();
                getSalaryUnitStr(0);
                //初始化并显示期望薪资设置组件
                initFullScreenLoginDemo(dialog);
            }
        };
        FullScreenDialog.show(onBindView);
    }

    /**
     * 初始化并显示期望薪资设置组件
     *
     * @param fullScreenDialog
     */
    private void initFullScreenLoginDemo(final FullScreenDialog fullScreenDialog) {
        btnCancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                fullScreenDialog.dismiss();
            }
        });

        btnCancel.setText("取消");
        btnSubmit.setText("确定");

        btnSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (rangeStart >= rangeEnd && !modeCode.equals("M")) {
                    Toaster.show("薪资范围选择错误，起始薪资大于结束薪资");
                } else {
                    fullScreenDialog.dismiss();
                    Toaster.show(rangeStart + "-" + rangeEnd + "元/" + modeName);
                    String salaryName = "";
                    if (modeCode.equals("M")) {
                        //binding.stvJobSalary.setCenterString(modeName);
                        salaryName = modeName;
                    } else {
                        //binding.stvJobSalary.setCenterString(rangeStart+"-"+rangeEnd+"元/"+modeName);
                        salaryName += rangeStart + "-" + rangeEnd + "元/" + modeName;
                    }

                    binding.stModifySalary.setCenterString(salaryName);
                    //设置数据
                    mJobInfoRequest.setSalaryMode(modeResultMap.get(modeCode));
                    //resumeJobCategoryRequest.setResumeId(mResumeInfoVo.getId());
                    mJobInfoRequest.setSalaryUnit(1);
                    mJobInfoRequest.setSalaryStart(rangeStart);
                    mJobInfoRequest.setSalaryEnd(rangeEnd);

                    //更新ListView数据源，刷新界面数据绑定
                   /* updateCategoryConfigListSalary(salaryName, selectedJobCategoryId);
                    //更新服务器数据
                    ResumeJobCategoryRequest resumeJobCategoryRequest = new ResumeJobCategoryRequest();
                    resumeJobCategoryRequest.setJobCategoryId(selectedJobCategoryId);
                    resumeJobCategoryRequest.setSalaryMode(modeResultMap.get(modeCode));
                    resumeJobCategoryRequest.setResumeId(mResumeInfoVo.getId());
                    resumeJobCategoryRequest.setSalaryUnit(1);
                    resumeJobCategoryRequest.setSalaryStart(rangeStart);
                    resumeJobCategoryRequest.setSalaryEnd(rangeEnd);
                    //调用接口，更新服务器数据
                    updateUserResumeJobCategorySalary(resumeJobCategoryRequest);*/

                }

            }
        });
    }

    //----------------------------------------

    /**
     * 发布职位/招工信息-操作
     */
    private void submitRecruit(){
        String jobTypeName = binding.tvModifyJobType.getChecked();
        String[] jobTypeList = getResources().getStringArray(R.array.job_type_option);
        ForEachUtils.forEach(Arrays.asList(jobTypeList), (index, item) -> {
           if(item.equals(jobTypeName)){
               mJobInfoRequest.setJobType(index);
           }
        });
        mJobInfoRequest.setContent(binding.fjEdit.getText());
        Log.i(TAG, GsonUtils.toJson(mJobInfoRequest));

        if(null==mJobInfoRequest.getJobUserAddress()){
           // XToastUtils.toast("请选择工作地址");
            Toaster.show("请选择工作地址");
            return;
        }

        if(StringUtils.isEmpty(mJobInfoRequest.getJobCategoryId())){
            XToastUtils.toast("请选择工种");
            return;
        }
        if(StringUtils.isEmpty(mJobInfoRequest.getContent())){
            XToastUtils.toast("请输入招工详情");
            return;
        }
        Log.i(TAG,"-------------------发布招工/职位数据-----------------------");
        Log.i(TAG,GsonUtils.toJson(mJobInfoRequest));
        Log.i(TAG,"-------------------发布招工/职位数据-----------------------");
        //提交接口
        if(isEdit && mJobInfoRequest.getId()!=null){
            updateJob(mJobInfoRequest);
        }else {
            createJob(mJobInfoRequest);
        }

    }

    /**
     * 发布招工/职位 接口
     * @param jobInfoRequest
     */
    @SuppressLint("CheckResult")
    private void createJob(JobInfoRequest jobInfoRequest){
        Log.i(TAG,"-------------发布职位信息详情------------------"+JsonUtil.toJson(jobInfoRequest));
        XHttpProxy.proxy(TestApi.IJobService.class)
                .createJob(jobInfoRequest)
                .subscribeWith(new NoTipRequestSubscriber<Object>() {

                    @Override
                    protected void onSuccess(Object o) {
                        Log.i(TAG,"-------------发布招聘信息详情------------------");
                        //customDialog.dismiss();
                        Toaster.show("发布成功");
                        new Handler().postDelayed(() -> {
                            openNewPage(RecruitManageFragment.class);
                        },1000);
                        Log.i(TAG,"-------------发布招聘信息详情------------------");
                    }

                    @Override
                    public void onError(ApiException e) {
                        super.onError(e);
                        //customDialog.dismiss();
                        ToastUtils.toast(e.getDisplayMessage());
                        Log.i(TAG,"-------------发布职位信息详情-返回错误------------------");
                        Log.e(TAG, e.getMessage());
                    }

                });
    }
    @SuppressLint("CheckResult")
    private void updateJob(JobInfoRequest jobInfoRequest){
        XHttpProxy.proxy(TestApi.IJobService.class)
                .updateJob(jobInfoRequest)
                .subscribeWith(new NoTipRequestSubscriber<Object>() {

                    @Override
                    protected void onSuccess(Object o) {
                        Log.i(TAG,"-------------修改招聘信息详情------------------");
                        //customDialog.dismiss();
                        Toaster.show("修改成功");
                        new Handler().postDelayed(() -> {
                            openNewPage(RecruitManageFragment.class);
                        },1000);
                        Log.i(TAG,"-------------修改招聘信息详情------------------");
                    }

                    @Override
                    public void onError(ApiException e) {
                        super.onError(e);
                        //customDialog.dismiss();
                        ToastUtils.toast(e.getDisplayMessage());
                        Log.i(TAG,"-------------修改职位信息详情-返回错误------------------");
                        Log.e(TAG, e.getMessage());
                    }

                });
    }
}